package com.csaba.connector;

//FIXME Exceptions shuld support internationalizations

/**
 * This is a generic exception that is thrown in all cases by the services.
 * Normally anyí exception that may occure during invocation of a bank service
 * should be wrapped in this exception, as well as errors received from the banking
 * server is indicated by this exception.
 * <p> the ServiceException is able to wrap other exceptions, and prepared to provide
 * native error messages (coming from the banking server) besides the normal message of
 * a java.lang.Exception.
 * <p> Use native message constructors ({@link #ServiceException(String, String)}
 * if you are going to wrap a bank server message, and specify appropriate
 * local message.
 * @author Gabe
 *
 */
@SuppressWarnings( "serial" )
public class ServiceException extends Exception
{

	private String nativeMessage;

	public ServiceException( final String message, final Throwable causedBy )
	{
		super(message, causedBy);
		this.nativeMessage = causedBy.getMessage();
	}

	public ServiceException( final String message )
	{
		super(message);
		this.nativeMessage = "";
	}

	public ServiceException( final String message, final String nativeMessage )
	{
		super(message);
		this.nativeMessage = nativeMessage;
	}

	public String getNativeMessage()
	{
		return nativeMessage;
	}

	public void setNativeMessage( final String nativeMessage )
	{
		this.nativeMessage = nativeMessage;
	}

}
